home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / namesp.frm < prev    next >
Text File  |  1995-05-07  |  4KB  |  141 lines

  1. VERSION 2.00
  2. Begin Form NameSpaceForm 
  3.    Caption         =   "Name Space Services Test"
  4.    ClientHeight    =   1650
  5.    ClientLeft      =   1305
  6.    ClientTop       =   1575
  7.    ClientWidth     =   4965
  8.    Height          =   2055
  9.    Left            =   1245
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1650
  12.    ScaleWidth      =   4965
  13.    Top             =   1230
  14.    Width           =   5085
  15.    Begin ComboBox VolumeBox 
  16.       Height          =   300
  17.       Left            =   1320
  18.       TabIndex        =   6
  19.       Top             =   1200
  20.       Width           =   2415
  21.    End
  22.    Begin ComboBox ServerNameBox 
  23.       Height          =   300
  24.       Left            =   1320
  25.       TabIndex        =   4
  26.       Top             =   720
  27.       Width           =   2415
  28.    End
  29.    Begin CommandButton OkButton 
  30.       Caption         =   "&OK"
  31.       Default         =   -1  'True
  32.       Height          =   375
  33.       Left            =   3840
  34.       TabIndex        =   3
  35.       Top             =   240
  36.       Width           =   975
  37.    End
  38.    Begin CommandButton CancelButton 
  39.       Caption         =   "&Cancel"
  40.       Height          =   375
  41.       Left            =   3840
  42.       TabIndex        =   0
  43.       Top             =   720
  44.       Width           =   975
  45.    End
  46.    Begin Label Label3 
  47.       Caption         =   "Select a file server and volume to scan for name space information."
  48.       Height          =   495
  49.       Left            =   360
  50.       TabIndex        =   5
  51.       Top             =   120
  52.       Width           =   3255
  53.    End
  54.    Begin Label Label1 
  55.       Alignment       =   1  'Right Justify
  56.       Caption         =   "Volume:"
  57.       Height          =   255
  58.       Left            =   360
  59.       TabIndex        =   2
  60.       Top             =   1200
  61.       Width           =   855
  62.    End
  63.    Begin Label Label2 
  64.       Alignment       =   1  'Right Justify
  65.       Caption         =   "File Server:"
  66.       Height          =   255
  67.       Left            =   120
  68.       TabIndex        =   1
  69.       Top             =   720
  70.       Width           =   1095
  71.    End
  72. End
  73.  
  74. Sub Form_Unload (Cancel As Integer)
  75.     SetPreferredConnectionID (originalPrefConnID%)
  76. End Sub
  77.  
  78. Sub GetVolumeList ()
  79.     Dim usage As NWVOL_USAGE
  80.  
  81.     VolumeBox.Clear
  82.  
  83.     connID% = GetPreferredConnectionID()
  84.     For volNum% = 0 To 31
  85.         ccode% = GetVolUsage(connID%, volNum%, usage)
  86.         If ((ccode% = SUCCESSFUL) And (Len(usage.volName) > 0)) Then
  87.             VolumeBox.AddItem usage.volName
  88.         End If
  89.     Next volNum%
  90.     VolumeBox.Text = VolumeBox.List(0)
  91. End Sub
  92.  
  93. Sub OKButton_Click ()
  94.     serverName$ = ServerNameBox.Text
  95.     volumeName$ = VolumeBox.Text
  96.     NameSpaceInfoForm.Show
  97. End Sub
  98.  
  99. Sub ServerNameBox_Click ()
  100.     prefServer$ = ServerNameBox.Text
  101.     
  102.     ccode% = GetConnectionID(prefServer$, connID%)
  103.     If (ccode% = SUCCESSFUL) Then
  104.         SetPreferredConnectionID (connID%)  'tell which file server to send
  105.                                             '   requests to
  106.         GetVolumeList
  107.     Else
  108.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  109.         connID% = GetDefaultConnectionID()
  110.         prefServer$ = String$(48, 0)
  111.         GetFileServerName connID%, prefServer$
  112.         prefServer$ = Left$(prefServer$, InStr(prefServer$, Chr$(0)) - 1)
  113.         ServerNameBox.Text = prefServer$
  114.     End If
  115. End Sub
  116.  
  117. Sub CancelButton_Click ()
  118.     Unload NameSpaceForm
  119. End Sub
  120.  
  121. Sub Form_Load ()
  122.     Dim volName As String * 16
  123.  
  124.     fileServerName$ = String$(48, 0)
  125.     For connID% = 1 To 8
  126.         If (ISConnectionIDInUse(connID%)) Then
  127.             GetFileServerName connID%, fileServerName$
  128.             ServerNameBox.AddItem fileServerName$
  129.         End If
  130.     Next connID%
  131.  
  132.     connID% = GetDefaultConnectionID()
  133.     SetPreferredConnectionID (connID%)
  134.     fileServerName$ = String$(48, 0)
  135.     GetFileServerName connID%, fileServerName$
  136.     fileServerName$ = Left$(fileServerName$, InStr(fileServerName$, Chr$(0)) - 1)
  137.     ServerNameBox.Text = fileServerName$
  138.     GetVolumeList
  139. End Sub
  140.  
  141.